package br.great.DAO;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* PhotoMap
* Copyright (c) 2007-2008 STEAMER - LIG, All rights reserved.
*/

/**
 * @author Developpement of PhotoMap
 */
public class DAO_CollectionHasMultimedia {
    
    private static volatile DAO_CollectionHasMultimedia instaceDAO_CollectionHasMultimedia = new DAO_CollectionHasMultimedia();
    
    /** The private constructor of DAO_CollectionHasMultimedia for singleton
    */
    private DAO_CollectionHasMultimedia(){
    }
    
    /** The method for get the instance of the class DAO_CollectionHasMultimedia
    * @return DAO_CollectionHasMultimedia instaceDAO_CollectionHasMultimedia
    */
    public static DAO_CollectionHasMultimedia getInstance() {
        //if(instaceDAO_CollectionHasMultimedia==null)
           synchronized(DAO_CollectionHasMultimedia.class) {
             if (instaceDAO_CollectionHasMultimedia == null)
               instaceDAO_CollectionHasMultimedia = new DAO_CollectionHasMultimedia();
           }
        return instaceDAO_CollectionHasMultimedia;
    }
    
    public void insertCollectionHasMultimedia(int idMultimedia, int idCollection){
        try {
            String insertCollectionHasMultimedia = "insert into COLLECTION_has_MULTIMEDIA values(" + idMultimedia + ",'" + idCollection + "');";
            PgConnect conn = PgConnect.getInstance();
            conn.executeInsert(insertCollectionHasMultimedia);
            conn.Close();
        } catch (SQLException ex) {
            Logger.getLogger(DAO_CollectionHasMultimedia.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
//    public static void main(String[] args){
//        
//        DAO_CollectionHasMultimedia.getInstance().insertCollectionHasMultimedia(1, 1);
//    }
}
